$(function () {
    forwardCalcValid();
});
function forwardCalcValid() {
    $("#forwardCalcForm").validate({
        rules: {
            b_stable: {
                required: true,
                minlength: 3,
                number: true,
                //isCode:true
            },
            b_scode: {
                required: true,
                minlength: 3,
            },
            b_ttable: {
                required: true,
                minlength: 3,
                //isCode:true
            },
            b_tcode: {
                required: true,
                minlength: 3,
            },
            b_cfunc_1: {
                required: true,
                minlength: 3,
                //isCode:true
            },
            b_rowSort: {
                required: true,
                isDigits: true
            }
        },
        errorPlacement: function(error, element) {
            error.appendTo(element.parent());
        },
        errorElement: "span",
        errorClass: "errortips",
        success: 'valid',
        messages: {
            b_stable: {
                required: " (必填)",
                minlength: " (不能少于 3 个字母)",
                number: "请输入数字",
            },
            b_scode: {
                required: " (必填)",
                minlength: " (不能少于 3 个字母)",
            },
            b_ttable:{
                required: " (必填)",
                minlength: " (不能少于6位密码)"
            },
            b_tcode:{
                required: " (必填)",
                minlength: " (不能少于6位密码)"
            },
            b_cfunc_1:{
                required: " (必填)",
                minlength: " (不能少于6位密码)"
            },
            b_rowSort:{
                required: " (必填)",
                isDigits: "输入正整数"
            }
        },
    });
}

function submitForm() {
    if($('#forwardCalcForm').valid()){
        return false;
    }
    return {};
}
/*
 jQuery.validator.addMethod("isCode", function(value, element) {
 return this.optional(element) || /^[a-zA-Z]{3}[0-9]{4}$/.test($("#b_deviceCode").val());
 }, "以字母开头，长度在6-12之间，只能包含字符、数字和下划线。");
 */
